package org.wz.complex.work.kit.clz;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.TableField;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

public interface ClzKit {

   public static List<String> getDbNames(Class<?> clz, String... excludes) {
       return Stream.of(clz.getDeclaredFields())
               .filter(field -> {
                   TableField tableFieldAnno = field.getDeclaredAnnotation(TableField.class);
                   boolean remove = null != tableFieldAnno && !tableFieldAnno.exist();
                   return !remove;
               })
               .map(s -> StrUtil.toUnderlineCase(s.getName()).toLowerCase())
               .filter(s -> !Arrays.asList(excludes).contains(StrUtil.toCamelCase(s)))
               .toList();
   }



}
